package com.gdpu.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.gdpu.bean.Cgdingdan;
import com.gdpu.bean.Cgdingdan;
import com.gdpu.mapper.CgdingdanMapper;
import com.gdpu.service.CgdingdanService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gdpu.vo.CgdingdanVo;
import com.gdpu.vo.CgdingdanVo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;


@Service
public class CgdingdanServiceImpl extends ServiceImpl<CgdingdanMapper, Cgdingdan> implements CgdingdanService {
    @Resource
    public CgdingdanMapper cgdingdanMapper;
    @Override
    public List<CgdingdanVo> voList() {
        List<Cgdingdan> cgdingdanList = this.cgdingdanMapper.selectList(null);
        CgdingdanVo cgdingdanVo = null;
        List<CgdingdanVo> result = new ArrayList<>();
        for (Cgdingdan cgdingdan : cgdingdanList) {
            cgdingdanVo = new CgdingdanVo();
            BeanUtil.copyProperties(cgdingdan, cgdingdanVo);
            if (cgdingdanVo.getType().equals("待确认"))
                cgdingdanVo.setType("待审核");
            result.add(cgdingdanVo);
        }
        return result;
    }
}
